<template>
	<div>
		<slot />
		<div v-if="errors&&errors.find(item=>item.path==keyName)" class="error">
			<image src="/static/card/warning.png" style="width: 25rpx;height:25rpx"></image>
			{{errors.find(item=>item.path==keyName).message}}
		</div>
	</div>
</template>

<script>
	export default {
		props: ["keyName", "errors"]
	}
</script>

<style lang="less">
	.error {
		background-color: #fff6ed;
		color: #ff8000;
		font-weight: bold;
		border: 1rpx solid #ffba75;
		padding:10rpx 20rpx;
		font-size: 22rpx;
		border-radius: 16rpx;
		display: flex;
		align-items: center;
		margin-top: 8rpx;
		image {
			margin-right: 8rpx;
		}
	}
</style>